%include
:- lib(ic), lib(listut).

testSumCalculate(Path, OState, Arg, Result, NState) :-
	Path > 0,
	% Domains
	[OStart] :: -127 .. 128,
	[NStart] :: -127 .. 128,
	[OEnd] :: -127 .. 128,
	[NEnd] :: -127 .. 128,
	% Constraints
	OState = [OStart, OEnd],
	NState = [NStart, NEnd],
	sumCalculate(Path, OState, Arg, Result, NState),
	% Solving
	indomain(OStart),
	indomain(NStart),
	indomain(OEnd),
	indomain(NEnd).

sumCalculate(1, [OStart, OEnd], [], Result, [NStart, NEnd]) :-
	% Invariant
	OStart #=< OEnd,
	% Postcondition
	Result = Answer,
	% Object State Update
	NStart #= OStart,
	NEnd #= OEnd,
	% Invariant
	NStart #=< NEnd.

